package com.lottery.ruok.lottrey.ui;

import android.text.Editable;
import android.text.TextWatcher;

import com.lottery.ruok.lottrey.bean.LotteryItem;
import com.lottery.ruok.lottrey.interfaces.TextWatch;

/**
 * Created by ASUS on 2017/11/13.
 */

public class MyTextWatcher implements TextWatcher {
    private LotteryItem lotteryItem;
    private TextWatch textWatch;

    public void setTextWatch(TextWatch textWatch) {
        this.textWatch = textWatch;
    }

    public MyTextWatcher(LotteryItem lotteryItem) {
        this.lotteryItem = lotteryItem;
    }

    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void afterTextChanged(Editable editable) {
        if(textWatch != null){
            textWatch.textWatch(editable, lotteryItem);
        }
    }
}